This is the notebook for the Month of May.
–
source("LoadAndProcess.R")
head(kk)
names(kk)
head(kk.long)
names(kk.long)
–
–
– # 4. Network plots
library(ggdendro)
library(dplyr)
library(reshape2)
# cast by roi
sc1 = dcast(kl2.scale, CHANNEL+GROUP+EXPT+ID~ SUBROI, value.var = "z",
fun.aggregate=mean)
# make matrix
sc1.matrix = as.matrix(sc1[, -c(1:4)])
# make ID the row names
rownames(sc1.matrix) = sc1$ID
# dendro
dendro.sc1 = as.dendrogram(hclust(d = dist(x=sc1.matrix)))
dendro.sc1.p = ggdendrogram(data = dendro.sc1, rotate=T)
# print
print(dendro.sc1.p)
row.order = hclust(dist(sc1.matrix))$order
col.order = hclust(dist(t(sc1.matrix)))$order
sc1.new = sc1[row.order, col.order]
sc1.molten = melt(as.matrix(sc1.new))
ggplot(data = sc1.molten,
aes(x = Var1, y = Var2, fill = value)) +
geom_raster() +
theme(axis.text.x = element_text(angle = 90, hjust = 1),
axis.text.y = element_blank()) +
ggtitle("Clustered ggplot heatmap")
library(RColorBrewer)
sc1.long = melt(sc1, id=c(1:4))
Error in melt(sc1, id = c(1:4)) : object 'sc1' not found